package com.ssmk.module.merchant.Presenter;

import android.content.Context;
import android.util.Log;

import com.blankj.utilcode.util.LogUtils;
import com.example.retrofitlibrary.BaseObserBean2;
import com.example.retrofitlibrary.RetrofitClientUtlis;
import com.ssmk.base.BasePresenter;
import com.ssmk.base.BaseView;
import com.ssmk.module.merchant.bean.ShangpinBean;
import com.ssmk.url.Url;

import java.util.HashMap;
import java.util.Map;


public class ShangpinPrestenser implements BasePresenter{
    private Context mContext;
    private BaseView mBaseView;
    private int id;
    public ShangpinPrestenser(Context context, BaseView baseView) {
        mContext = context;
        mBaseView = baseView;
    }
    @Override
    public void SetDataModel(Object o){

    }

    public void setId(int id) {
        this.id = id;
        GetDataModel();
    }
    @Override
    public void GetDataModel(){
        Map<String,String> map = new HashMap<>();
        map.put("sellerId",id+"");
        RetrofitClientUtlis.getInstance(mContext, Url.Shangpinfenlei)
                        .createBaseApi().post2(
                        Url.fenleiitem,
                        map,
                        new BaseObserBean2<ShangpinBean>(mContext, ShangpinBean.class){
            @Override
            public void Next(ShangpinBean data){
                mBaseView.UpData(data);
                LogUtils.e("ShangpinBean",data.toString());
            }
        });
    }
}
